﻿<UserControl x:Class="FormCreator.View.ElementPalette"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"   
             xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             MaxWidth="300">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        
        <TextBlock Margin="10 20 20 20" FontWeight="Bold" FontSize="14" Text="Available fields"/>
        <ListBox Grid.Row="1" ItemsSource="{Binding ElementTypes}" BorderThickness="0" dd:DragDrop.IsDragSource="True">                 
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="10">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TextBlock Grid.Row="0" FontWeight="Bold" Text="{Binding Name}"/>
                        <TextBlock MaxWidth="270" Grid.Row="1" Text="{Binding Description}" TextWrapping="Wrap"/>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <Button Grid.Row="2" Command="{Binding LoadAssemblyCommand}" Content="Load assembly..."/>
    </Grid>
</UserControl>
